package com.ktwlsoft.archivemanage.controller.dataProfile;

import com.ktwlsoft.archivemanage.domain.business.businessService.ArchivistEfficiencyProfileService;
import com.ktwlsoft.archivemanage.payload.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.time.Year;

@Api(description = "人员效率分析")
@RestController
@RequestMapping("/archivistEfficiency")
public class ArchivistEfficiencyController {

    private final ArchivistEfficiencyProfileService archivistEfficencyProfileService;

    public ArchivistEfficiencyController(ArchivistEfficiencyProfileService archivistEfficencyProfileService) {
        this.archivistEfficencyProfileService = archivistEfficencyProfileService;
    }

    @ApiOperation("业务检查员旗下立档单位平均得分的年度变化趋势")
    @GetMapping("/getEfficiencyPoints")
    public ResponseEntity<?> getEfficiencyPoints(@ApiParam("档案员id") @RequestParam Long instructorId) {
        return ResponseEntity.ok(Result.ok(archivistEfficencyProfileService.getAvgMarkOfYears(instructorId)));
    }

    @ApiOperation("业务检查旗下立档单位平均得分列表")
    @GetMapping("/getEfficiencyPointsOfArchivist")
    public ResponseEntity<?> getEfficiencyPointsOfArchivist(@ApiParam("年度") @RequestParam Year year) {
        return ResponseEntity.ok(Result.ok(archivistEfficencyProfileService.getAvgMarkOfYearsOfInstructor(year)));
    }

    @ApiOperation("业务检查单量和检查整改单量情况统计")
    @GetMapping("/getEfficiencyOfGuianceAndMend")
    public ResponseEntity<?> getEfficiencyOfGuianceAndMend(@ApiParam("年度") @RequestParam Year year) {
        return ResponseEntity.ok(Result.ok(archivistEfficencyProfileService.getEfficiencyOfGuianceAndMend(year)));
    }
}
